<script setup lang="ts">
import { ref } from 'vue'

const stars = ref(40)
</script>

<template>
  <div class="container">
    <div class="error-content">
      <h1 class="error-code">404</h1>
      <h2 class="error-message">Page Not Found</h2>
      <p class="error-description">
        Oops! The page you're looking for seems to have vanished into the void.
      </p>
      <router-link to="/" class="home-link">
        ← Return to Homepage
      </router-link>
    </div>

    <!-- 星空背景动画 -->
    <div class="stars">
      <div
          v-for="star in stars"
          :key="star"
          class="star"
          :style="{
          left: `${Math.random() * 100}%`,
          top: `${Math.random() * 100}%`,
          animationDelay: `${Math.random() * 3}s`
        }"
      ></div>
    </div>
  </div>
</template>

<style scoped>
.container {
  min-height: 100vh;
  background: linear-gradient(45deg, #1a1a1a, #2d2d2d);
  color: #fff;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-content {
  text-align: center;
  z-index: 1;
  padding: 2rem;
  max-width: 600px;
}

.error-code {
  font-size: 8rem;
  margin: 0;
  line-height: 1;
  color: #ff4757;
  text-shadow: 0 0 20px rgba(255, 71, 87, 0.4);
  animation: float 3s ease-in-out infinite;
}

.error-message {
  font-size: 2rem;
  margin: 1rem 0;
  color: #dfe4ea;
}

.error-description {
  font-size: 1.1rem;
  margin: 1rem 0 2rem;
  color: #a4b0be;
  line-height: 1.6;
}

.home-link {
  display: inline-block;
  padding: 12px 24px;
  background: #ff4757;
  color: white;
  text-decoration: none;
  border-radius: 25px;
  transition: all 0.3s ease;
}

.home-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 71, 87, 0.3);
}

.stars {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: white;
  border-radius: 50%;
  animation: twinkle 1.5s infinite;
}

@keyframes twinkle {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 8px white;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

@media (max-width: 768px) {
  .error-code {
    font-size: 6rem;
  }

  .error-message {
    font-size: 1.5rem;
  }
}
</style>